package jpb.test.mock;

import jpb.*;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Mock implementation of {@link jpb.Jvm}.
 *
 * @author Dariusz Kordonski
 */
public class MockJvm implements Jvm
{

    private StartupCommandSelector startupCommand;
    private final Map<CommandArg, Boolean> dryRuns = new HashMap<CommandArg,Boolean>();

    @Override
    public StartupCommandSelector commandSelector() {
        return startupCommand;
    }

    public MockJvm commandSelector(StartupCommandSelector newSelector) {
        this.startupCommand = newSelector;
        return this;
    }

    @Override
    public boolean dryRun(CommandArg startupCommand) {
        Boolean result = dryRuns.get(startupCommand);
        if (result != null) {
            return result;
        }
        return false;
    }

    public MockJvm stubDryRun(CommandArg arg, boolean result) {
        dryRuns.put(arg, result);
        return this;
    }

    @Override
    public JvmArg<EntryPoint> entryPointArg()
    {
        return null;
    }

    @Override
    public JvmArg<List<File>> classPathArg()
    {
        return null;
    }

    @Override
    public JvmArg<MemArg> maxMemoryArg()
    {
        return null;
    }

    @Override
    public JvmArg<MemArg> minMemoryArg()
    {
        return null;
    }

    @Override
    public JvmArg<MemArg> maxStackSizeArg()
    {
        return null;
    }

    @Override
    public JvmArg<Map<String, String>> systemPropertiesArg()
    {
        return null;
    }
}
